package com.magenta.maxoptra.gis;

/**
 * Project: MaxOptra
 * User: kaganov
 * Date: 24.02.2009 17:42:03
 * <p/>
 * Copyright (c) 1999-2007 Magenta Corporation Ltd. All Rights Reserved.
 * Magenta Technology proprietary and confidential.
 * Use is subject to license terms.
 */
public class Proxy {

    protected Long id;

    private String host;

    private String user;

    private String password;

    private int port;

    private boolean enable;

    public Proxy() {
    }

    public Proxy(Boolean proxyEnabled, String proxyHost, String proxyUser, String proxyPassword, String proxyPort) {
        this();
        enable = proxyEnabled != null ? proxyEnabled : false;
        host = proxyHost;
        user = proxyUser;
        password = proxyPassword;
        port = proxyPort != null ? Short.valueOf(proxyPort) : 0;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
    	throwIfNull(id);
        this.id = id;
    }

    private void throwIfNull(Object value) {
    	if ( value== null ) {
    		throw new IllegalArgumentException("Possible NullPointerException");
    	}
	}

	public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }
}
